package test1.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import test1.pojo.Order;
import test1.service.OrderService;


@RestController
@RequestMapping("test1order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @RequestMapping("update")
    @ResponseBody
    public String update(@RequestParam("it") Integer id) {
        orderService.updateOrder(id);
        return "success";
    }

    @RequestMapping("update/{ids}")
    @ResponseBody
    public String updateRest(@PathVariable("ids") Integer id) {
        orderService.updateOrder(id);
        return "success";
    }

    @RequestMapping("find")
    @ResponseBody
    public Order find(@RequestParam("id") Integer ids) {
        int i = 1/0;
        return orderService.findOrderById(ids);
    }
}
